package com.bytedance.frameworks.core.thread;

import java.util.concurrent.Executors;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public final class g {
    private static final int a;
    private static final int b;
    private static final int c;
    private static final PriorityBlockingQueue d;
    private static final PriorityBlockingQueue e;

    static {
        int v1 = 4;
        int v0 = Runtime.getRuntime().availableProcessors();
        a = v0;
        v0 = v0 / 2 + 1 < v1 ? v1 : g.a / 2 + 1;
        b = v0;
        if (g.a / 2 + 1 >= v1) {
            v1 = g.a / 2 + 1;
        }
        c = v1;
        d = new PriorityBlockingQueue();
        e = new PriorityBlockingQueue();
    }

    public static ThreadPoolExecutor a() {
        return new ThreadPoolExecutor(g.b, g.b, 1, TimeUnit.SECONDS, g.d, new f(TTPriority$Priority.NORMAL, "tt-api-thread-"));
    }

    public static ThreadPoolExecutor b() {
        return new ThreadPoolExecutor(g.c, g.c, 1, TimeUnit.SECONDS, g.e, new f(TTPriority$Priority.NORMAL, "tt-default-thread-"));
    }

    public static ScheduledExecutorService c() {
        return Executors.newSingleThreadScheduledExecutor(new f(TTPriority$Priority.LOW, "tt-delay-thread-"));
    }
}

